import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class BufferedCharWriter {
    public static void main(String[] args) {
        try {
            FileWriter fileWriter = new FileWriter("char_file.txt");

            // fileWriter.write("今天下午在教室上课，太热了！");
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
            bufferedWriter.write("心静自然凉");

            // 刷新操作，将缓冲区中的内容保存到硬盘
            bufferedWriter.flush();
            // 关闭输出流缓冲区
            bufferedWriter.close();
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
